<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Netplan Configurator</title>
    <link href="/css/bootstrap.min.css" rel="stylesheet">
    <link href="/css/index.css" rel="stylesheet">
</head>
<body>
    <!-- Toggle Button -->
    <div class="sidebar-toggle btn btn-secondary">
        <span id="toggle-sidebar">☰</span>
    </div>

    <div class="sidebar">
        <h4 class="text-center">导航</h4>
        <ul class="nav flex-column">
            <li class="nav-item">
                <a class="nav-link active" href="/">Home</a>
            </li>
            <li class="nav-item">
                <a class="nav-link active" href="/control.html">Control</a>
            </li>
            <li class="nav-item">
                <a class="nav-link active" href="/servo.html">Offset</a>
            </li>
            <li class="nav-item">
                <a class="nav-link active" href="/config_exposure">Exposure Config</a>
            </li>
            <!-- Add more navigation items here -->
        </ul>
    </div>

    <div class="main-content">
        <h1 class="mb-4">Netplan Configuration</h1>
        <form action="/update_config" method="post">
            <div class="form-group">
                <label for="dhcp">Enable DHCP:</label>
                <select name="dhcp" id="dhcp" class="form-control">
                    <option value="false">No</option>
                </select>
            </div>
            <div class="form-group">
                <label for="ip_address">IP Address:</label>
                <input type="text" name="ip_address" id="ip_address" class="form-control" placeholder="e.g., 192.168.1.100">
            </div>
            <div class="form-group">
                <label for="netmask">Netmask (prefix length):</label>
                <input type="text" name="netmask" id="netmask" class="form-control" placeholder="e.g., 24">
            </div>
            <div class="form-group">
                <label for="gateway">Gateway:</label>
                <input type="text" name="gateway" id="gateway" class="form-control" placeholder="e.g., 192.168.1.1">
            </div>
            <div class="form-group">
                <label for="dns">DNS Servers (comma separated):</label>
                <input type="text" name="dns" id="dns" class="form-control" placeholder="e.g., 8.8.8.8, 8.8.4.4">
            </div>
            <button type="submit" class="btn btn-primary">Update Configuration</button>
        </form>
        <h3 class="mt-4">Current Netplan Configuration:</h3>
        <pre>{{ config_text }}</pre>
    </div>

	<script src="{{ url_for('static', filename='js/jquery-3.6.0.min.js') }}"></script>
    <script src="{{ url_for('static', filename='js/popper.min.js') }}"></script>
    <script src="{{ url_for('static', filename='js/bootstrap.min.js') }}"></script>
    <script>
        document.getElementById('toggle-sidebar').addEventListener('click', function() {
        var sidebar = document.querySelector('.sidebar');
        var mainContent = document.querySelector('.main-content');
        sidebar.classList.toggle('show');
        mainContent.classList.toggle('shifted');
    });
    </script>
</body>
</html>
